/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lyra.pojos;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Koustas, Marmaridis, Mariolou
 */
@Entity
@Table(name = "ALBUMTYPE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Albumtype.findAll", query = "SELECT a FROM Albumtype a"),
    @NamedQuery(name = "Albumtype.findByAlbumtypeid", query = "SELECT a FROM Albumtype a WHERE a.albumtypeid = :albumtypeid"),
    @NamedQuery(name = "Albumtype.findByName", query = "SELECT a FROM Albumtype a WHERE a.name = :name"),
    @NamedQuery(name = "Albumtype.findByDescription", query = "SELECT a FROM Albumtype a WHERE a.description = :description")})
public class Albumtype implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ALBUMTYPEID")
    private Long albumtypeid;
    @Column(name = "NAME")
    private String name;
    @Column(name = "DESCRIPTION")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "albumtypeid")
    private Collection<Album> albumCollection;

    public Albumtype() {
    }

    public Albumtype(Long albumtypeid) {
        this.albumtypeid = albumtypeid;
    }

    public Long getAlbumtypeid() {
        return albumtypeid;
    }

    public void setAlbumtypeid(Long albumtypeid) {
        this.albumtypeid = albumtypeid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<Album> getAlbumCollection() {
        return albumCollection;
    }

    public void setAlbumCollection(Collection<Album> albumCollection) {
        this.albumCollection = albumCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (albumtypeid != null ? albumtypeid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Albumtype)) {
            return false;
        }
        Albumtype other = (Albumtype) object;
        if ((this.albumtypeid == null && other.albumtypeid != null) || (this.albumtypeid != null && !this.albumtypeid.equals(other.albumtypeid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "lyra.pojos.Albumtype[ albumtypeid=" + albumtypeid + " ]";
    }
    
}
